package com.core.cloundbusinessapi.sheet.mayor.enums;

/**
 * @author =====Lqj=====
 * @className CloudSheetMayorResultCode
 * @description
 * @create 2024/11/19 19:42
 **/

public enum CloudSheetMayorResultCode {

    CODE500001(500001, "导入12345工单请求参数为空，请检查"),
    CODE500002(500002, "查询工单详情请求参数为空，请检查"),

    CODE500003(500003, "拆单操作失败单号或处理单位为空，请检查"),

    CODE500004(500004, "拆单操作失败处理单位不存在，请检查"),

    CODE500005(500005, "导入工单失败处理单位不存在，请检查"),
    CODE500006(500006, "拉取工单时间跨度大于48小时，请检查");



    private final Integer code;
    private final String msg;

    CloudSheetMayorResultCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    // 获取 code 值
    public Integer getCode() {
        return code;
    }

    // 获取 msg 值
    public String getMsg() {
        return msg;
    }

    /**
     * 通过 code 获取枚举项
     */
    public static CloudSheetMayorResultCode getByCode(Integer code) {
        if (code == null) {
            throw new IllegalStateException("响应编码不能为空");
        }
        for (CloudSheetMayorResultCode resultCode : CloudSheetMayorResultCode.values()) {
            if (resultCode.getCode().equals(code)) {
                return resultCode;
            }
        }
        throw new IllegalStateException("编码不存请重试输入,不存在的编码：" + code);
    }
}
